!function(t){"undefined"==typeof t.fn.each2&&t.extend(t.fn,{each2:function(e){for(var i=t([0]),s=-1,a=this.length;++si;i++)a=t.charAt(i),e+=J[a]||a;return e}function s(t,e){for(var i=0,s=e.length;s>i;i+=1)if(n(t,e[i]))return i;return-1}function a(){var e=t($);e.appendTo("body");var i={width:e.width()-e[0].clientWidth,height:e.height()-e[0].clientHeight};return e.remove(),i}function n(t,i){return t===i?!0:t===e||i===e?!1:null===t||null===i?!1:t.constructor===String?t+""==i+"":i.constructor===String?i+""==t+"":!1}function o(e,i){var s,a,n;if(null===e||e.length<1)return[];for(s=e.split(i),a=0,n=s.length;n>a;a+=1)s[a]=t.trim(s[a]);return s}function r(t){return t.outerWidth(!1)-t.width()}function l(i){var s="keyup-change-value";i.on("keydown",function(){t.data(i,s)===e&&t.data(i,s,i.val())}),i.on("keyup",function(){var a=t.data(i,s);a!==e&&i.val()!==a&&(t.removeData(i,s),i.trigger("keyup-change"))})}function h(i){i.on("mousemove",function(i){var s=U;(s===e||s.x!==i.pageX||s.y!==i.pageY)&&t(i.target).trigger("mousemove-filtered",i)})}function c(t,i,s){s=s||e;var a;return function(){var e=arguments;window.clearTimeout(a),a=window.setTimeout(function(){i.apply(s,e)},t)}}function d(t){var e,i=!1;return function(){return i===!1&&(e=t(),i=!0),e}}function u(t,e){var i=c(t,function(t){e.trigger("scroll-debounced",t)});e.on("scroll",function(t){s(t.target,e.get())>=0&&i(t)})}function p(t){t[0]!==document.activeElement&&window.setTimeout(function(){var e,i=t[0],s=t.val().length;t.focus(),t.is(":visible")&&i===document.activeElement&&(i.setSelectionRange?i.setSelectionRange(s,s):i.createTextRange&&(e=i.createTextRange(),e.collapse(!1),e.select()))},0)}function f(e){e=t(e)[0];var i=0,s=0;if("selectionStart"in e)i=e.selectionStart,s=e.selectionEnd-i;else if("selection"in document){e.focus();var a=document.selection.createRange();s=document.selection.createRange().text.length,a.moveStart("character",-e.value.length),i=a.text.length-s}return{offset:i,length:s}}function m(t){t.preventDefault(),t.stopPropagation()}function g(t){t.preventDefault(),t.stopImmediatePropagation()}function v(e){if(!I){var i=e[0].currentStyle||window.getComputedStyle(e[0],null);I=t(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:i.fontSize,fontFamily:i.fontFamily,fontStyle:i.fontStyle,fontWeight:i.fontWeight,letterSpacing:i.letterSpacing,textTransform:i.textTransform,whiteSpace:"nowrap"}),I.attr("class","select2-sizer"),t("body").append(I)}return I.text(e.val()),I.width()}function y(e,i,s){var a,n,o=[];a=e.attr("class"),a&&(a=""+a,t(a.split(" ")).each2(function(){0===this.indexOf("select2-")&&o.push(this)})),a=i.attr("class"),a&&(a=""+a,t(a.split(" ")).each2(function(){0!==this.indexOf("select2-")&&(n=s(this),n&&o.push(this))})),e.attr("class",o.join(" "))}function b(t,e,s,a){var n=i(t.toUpperCase()).indexOf(i(e.toUpperCase())),o=e.length;return 0>n?(s.push(a(t)),void 0):(s.push(a(t.substring(0,n))),s.push(""),s.push(a(t.substring(n,n+o))),s.push(""),s.push(a(t.substring(n+o,t.length))),void 0)}function S(t){var e={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(t).replace(/[&<>"'\/\\]/g,function(t){return e[t]})}function w(i){var s,a=null,n=i.quietMillis||100,o=i.url,r=this;return function(l){window.clearTimeout(s),s=window.setTimeout(function(){var s=i.data,n=o,h=i.transport||t.fn.select2.ajaxDefaults.transport,c={type:i.type||"GET",cache:i.cache||!1,jsonpCallback:i.jsonpCallback||e,dataType:i.dataType||"json"},d=t.extend({},t.fn.select2.ajaxDefaults.params,c);s=s?s.call(r,l.term,l.page,l.context):null,n="function"==typeof n?n.call(r,l.term,l.page,l.context):n,a&&a.abort(),i.params&&(t.isFunction(i.params)?t.extend(d,i.params.call(r)):t.extend(d,i.params)),t.extend(d,{url:n,dataType:i.dataType,data:s,success:function(t){var e=i.results(t,l.page);l.callback(e)}}),a=h.call(r,d)},n)}}function k(e){var i,s,a=e,n=function(t){return""+t.text};t.isArray(a)&&(s=a,a={results:s}),t.isFunction(a)===!1&&(s=a,a=function(){return s});var o=a();return o.text&&(n=o.text,t.isFunction(n)||(i=o.text,n=function(t){return t[i]})),function(e){var i,s=e.term,o={results:[]};return""===s?(e.callback(a()),void 0):(i=function(a,o){var r,l;if(a=a[0],a.children){r={};for(l in a)a.hasOwnProperty(l)&&(r[l]=a[l]);r.children=[],t(a.children).each2(function(t,e){i(e,r.children)}),(r.children.length||e.matcher(s,n(r),a))&&o.push(r)}else e.matcher(s,n(a),a)&&o.push(a)},t(a().results).each2(function(t,e){i(e,o.results)}),e.callback(o),void 0)}}function C(i){var s=t.isFunction(i);return function(a){var n=a.term,o={results:[]};t(s?i():i).each(function(){var t=this.text!==e,i=t?this.text:this;(""===n||a.matcher(n,i))&&o.results.push(t?this:{id:this,text:this})}),a.callback(o)}}function M(e,i){if(t.isFunction(e))return!0;if(!e)return!1;throw new Error(i+" must be a function or a falsy value")}function D(e){return t.isFunction(e)?e():e}function T(e){var i=0;return t.each(e,function(t,e){e.children?i+=T(e.children):i++}),i}function x(t,i,s,a){var o,r,l,h,c,d=t,u=!1;if(!a.createSearchChoice||!a.tokenSeparators||a.tokenSeparators.length<1)return e;for(;;){for(r=-1,l=0,h=a.tokenSeparators.length;h>l&&(c=a.tokenSeparators[l],r=t.indexOf(c),!(r>=0));l++);if(0>r)break;if(o=t.substring(0,r),t=t.substring(r+c.length),o.length>0&&(o=a.createSearchChoice.call(this,o,i),o!==e&&null!==o&&a.id(o)!==e&&null!==a.id(o))){for(u=!1,l=0,h=i.length;h>l;l++)if(n(a.id(o),a.id(i[l]))){u=!0;break}u||s(o)}}return d!==t?t:void 0}function P(e,i){var s=function(){};return s.prototype=new e,s.prototype.constructor=s,s.prototype.parent=e.prototype,s.prototype=t.extend(s.prototype,i),s}if(window.Select2===e){var A,E,F,L,O,I,j,N,U={x:0,y:0},A={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(t){switch(t=t.which?t.which:t){case A.LEFT:case A.RIGHT:case A.UP:case A.DOWN:return!0}return!1},isControl:function(t){var e=t.which;switch(e){case A.SHIFT:case A.CTRL:case A.ALT:return!0}return t.metaKey?!0:!1},isFunctionKey:function(t){return t=t.which?t.which:t,t>=112&&123>=t}},$="
",J={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z"};j=t(document),O=function(){var t=1;return function(){return t++}}(),j.on("mousemove",function(t){U.x=t.pageX,U.y=t.pageY}),E=P(Object,{bind:function(t){var e=this;return function(){t.apply(e,arguments)}},init:function(i){var s,n,o,r,c=".select2-results";this.opts=i=this.prepareOpts(i),this.id=i.id,i.element.data("select2")!==e&&null!==i.element.data("select2")&&i.element.data("select2").destroy(),this.container=this.createContainer(),this.containerId="s2id_"+(i.element.attr("id")||"autogen"+O()),this.containerSelector="#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.body=d(function(){return i.element.closest("body")}),y(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",i.element.attr("style")),this.container.css(D(i.containerCss)),this.container.addClass(D(i.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",m),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),y(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(D(i.dropdownCssClass)),this.dropdown.data("select2",this),this.dropdown.on("click",m),this.results=s=this.container.find(c),this.search=n=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",m),h(this.results),this.dropdown.on("mousemove-filtered touchstart touchmove touchend",c,this.bind(this.highlightUnderEvent)),u(80,this.results),this.dropdown.on("scroll-debounced",c,this.bind(this.loadMoreIfNeeded)),t(this.container).on("change",".select2-input",function(t){t.stopPropagation()}),t(this.dropdown).on("change",".select2-input",function(t){t.stopPropagation()}),t.fn.mousewheel&&s.mousewheel(function(t,e,i,a){var n=s.scrollTop();a>0&&0>=n-a?(s.scrollTop(0),m(t)):0>a&&s.get(0).scrollHeight-s.scrollTop()+a<=s.height()&&(s.scrollTop(s.get(0).scrollHeight-s.height()),m(t))}),l(n),n.on("keyup-change input paste",this.bind(this.updateResults)),n.on("focus",function(){n.addClass("select2-focused")}),n.on("blur",function(){n.removeClass("select2-focused")}),this.dropdown.on("mouseup",c,this.bind(function(e){t(e.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(e),this.selectHighlighted(e))})),this.dropdown.on("click mouseup mousedown",function(t){t.stopPropagation()}),t.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==i.maximumInputLength&&this.search.attr("maxlength",i.maximumInputLength);var o=i.element.prop("disabled");o===e&&(o=!1),this.enable(!o);var r=i.element.prop("readonly");r===e&&(r=!1),this.readonly(r),N=N||a(),this.autofocus=i.element.prop("autofocus"),i.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.nextSearchTerm=e},destroy:function(){var t=this.opts.element,i=t.data("select2");this.close(),this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),i!==e&&(i.container.remove(),i.dropdown.remove(),t.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?t.attr({tabindex:this.elementTabIndex}):t.removeAttr("tabindex"),t.show())},optionToData:function(t){return t.is("option")?{id:t.prop("value"),text:t.text(),element:t.get(),css:t.attr("class"),disabled:t.prop("disabled"),locked:n(t.attr("locked"),"locked")||n(t.data("locked"),!0)}:t.is("optgroup")?{text:t.attr("label"),children:[],element:t.get(),css:t.attr("class")}:void 0},prepareOpts:function(i){var s,a,r,l,h=this;if(s=i.element,"select"===s.get(0).tagName.toLowerCase()&&(this.select=a=i.element),a&&t.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in i)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a ","
"," "," ","
"].join("")); return e},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var i,s,a;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.search.focus(),i=this.search.get(0),i.createTextRange?(s=i.createTextRange(),s.collapse(!1),s.select()):i.setSelectionRange&&(a=this.search.val().length,i.setSelectionRange(a,a)),""===this.search.val()&&this.nextSearchTerm!=e&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(t.Event("select2-open"))},close:function(t){this.opened()&&(this.parent.close.apply(this,arguments),t=t||{focus:!0},this.focusser.removeAttr("disabled"),t.focus&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.removeAttr("disabled"),this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.removeAttr("disabled"),this.focusser.focus()},destroy:function(){t("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments)},initContainer:function(){var e,i=this.container,s=this.dropdown;this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=e=i.find(".select2-choice"),this.focusser=i.find(".select2-focusser"),this.focusser.attr("id","s2id_autogen"+O()),t("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.focusser.attr("id")),this.focusser.attr("tabindex",this.elementTabIndex),this.search.on("keydown",this.bind(function(t){if(this.isInterfaceEnabled()){if(t.which===A.PAGE_UP||t.which===A.PAGE_DOWN)return m(t),void 0;switch(t.which){case A.UP:case A.DOWN:return this.moveHighlight(t.which===A.UP?-1:1),m(t),void 0;case A.ENTER:return this.selectHighlighted(),m(t),void 0;case A.TAB:return this.selectHighlighted({noFocus:!0}),void 0;case A.ESC:return this.cancel(t),m(t),void 0}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body().get(0)&&window.setTimeout(this.bind(function(){this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(t){if(this.isInterfaceEnabled()&&t.which!==A.TAB&&!A.isControl(t)&&!A.isFunctionKey(t)&&t.which!==A.ESC){if(this.opts.openOnEnter===!1&&t.which===A.ENTER)return m(t),void 0;if(t.which==A.DOWN||t.which==A.UP||t.which==A.ENTER&&this.opts.openOnEnter){if(t.altKey||t.ctrlKey||t.shiftKey||t.metaKey)return;return this.open(),m(t),void 0}return t.which==A.DELETE||t.which==A.BACKSPACE?(this.opts.allowClear&&this.clear(),m(t),void 0):void 0}})),l(this.focusser),this.focusser.on("keyup-change input",this.bind(function(t){if(this.opts.minimumResultsForSearch>=0){if(t.stopPropagation(),this.opened())return;this.open()}})),e.on("mousedown","abbr",this.bind(function(t){this.isInterfaceEnabled()&&(this.clear(),g(t),this.close(),this.selection.focus())})),e.on("mousedown",this.bind(function(e){this.container.hasClass("select2-container-active")||this.opts.element.trigger(t.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),m(e)})),s.on("mousedown",this.bind(function(){this.search.focus()})),e.on("focus",this.bind(function(t){m(t)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(t.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(t.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(t.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(e){var i=this.selection.data("select2-data");if(i){var s=t.Event("select2-clearing");if(this.opts.element.trigger(s),s.isDefaultPrevented())return;var a=this.getPlaceholderOption();this.opts.element.val(a?a.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),e!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(i),choice:i}),this.triggerChange({removed:i}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var t=this;this.opts.initSelection.call(null,this.opts.element,function(i){i!==e&&null!==i&&(t.updateSelection(i),t.close(),t.setPlaceholder())})}},isPlaceholderOptionSelected:function(){var t;return this.getPlaceholder()?(t=this.getPlaceholderOption())!==e&&t.is(":selected")||""===this.opts.element.val()||this.opts.element.val()===e||null===this.opts.element.val():!1},prepareOpts:function(){var e=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===e.element.get(0).tagName.toLowerCase()?e.initSelection=function(t,e){var s=t.find(":selected");e(i.optionToData(s))}:"data"in e&&(e.initSelection=e.initSelection||function(i,s){var a=i.val(),o=null;e.query({matcher:function(t,i,s){var r=n(a,e.id(s));return r&&(o=s),r},callback:t.isFunction(s)?function(){s(o)}:t.noop})}),e},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===e?e:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var t=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&t!==e){if(this.select&&this.getPlaceholderOption()===e)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(t)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(t,e,i){var s=0,a=this;if(this.findHighlightableChoices().each2(function(t,e){return n(a.id(e.data("select2-data")),a.opts.element.val())?(s=t,!1):void 0}),i!==!1&&(e===!0&&s>=0?this.highlight(s):this.highlight(0)),e===!0){var o=this.opts.minimumResultsForSearch;o>=0&&this.showSearch(T(t.results)>=o)}},showSearch:function(e){this.showSearchInput!==e&&(this.showSearchInput=e,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!e),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!e),t(this.dropdown,this.container).toggleClass("select2-with-searchbox",e))},onSelect:function(t,e){if(this.triggerSelect(t)){var i=this.opts.element.val(),s=this.data();this.opts.element.val(this.id(t)),this.updateSelection(t),this.opts.element.trigger({type:"select2-selected",val:this.id(t),choice:t}),this.nextSearchTerm=this.opts.nextSearchTerm(t,this.search.val()),this.close(),e&&e.noFocus||this.focusser.focus(),n(i,this.id(t))||this.triggerChange({added:t,removed:s})}},updateSelection:function(t){var i,s,a=this.selection.find(".select2-chosen");this.selection.data("select2-data",t),a.empty(),null!==t&&(i=this.opts.formatSelection(t,a,this.opts.escapeMarkup)),i!==e&&a.append(i),s=this.opts.formatSelectionCssClass(t,a),s!==e&&a.addClass(s),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==e&&this.container.addClass("select2-allowclear")},val:function(){var t,i=!1,s=null,a=this,n=this.data();if(0===arguments.length)return this.opts.element.val();if(t=arguments[0],arguments.length>1&&(i=arguments[1]),this.select)this.select.val(t).find(":selected").each2(function(t,e){return s=a.optionToData(e),!1}),this.updateSelection(s),this.setPlaceholder(),i&&this.triggerChange({added:s,removed:n});else{if(!t&&0!==t)return this.clear(i),void 0;if(this.opts.initSelection===e)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(t),this.opts.initSelection(this.opts.element,function(t){a.opts.element.val(t?a.id(t):""),a.updateSelection(t),a.setPlaceholder(),i&&a.triggerChange({added:t,removed:n})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(t){var i,s=!1;return 0===arguments.length?(i=this.selection.data("select2-data"),i==e&&(i=null),i):(arguments.length>1&&(s=arguments[1]),t?(i=this.data(),this.opts.element.val(t?this.id(t):""),this.updateSelection(t),s&&this.triggerChange({added:t,removed:i})):this.clear(s),void 0)}}),L=P(E,{createContainer:function(){var e=t(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["","
"," ","
"].join(""));return e},prepareOpts:function(){var e=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===e.element.get(0).tagName.toLowerCase()?e.initSelection=function(t,e){var s=[];t.find(":selected").each2(function(t,e){s.push(i.optionToData(e))}),e(s)}:"data"in e&&(e.initSelection=e.initSelection||function(i,s){var a=o(i.val(),e.separator),r=[];e.query({matcher:function(i,s,o){var l=t.grep(a,function(t){return n(t,e.id(o))}).length;return l&&r.push(o),l},callback:t.isFunction(s)?function(){for(var t=[],i=0;i0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(t.Event("select2-focus")),this.open(),this.focusSearch(),e.preventDefault()))})),this.container.on("focus",i,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(t.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var t=this;this.opts.initSelection.call(null,this.opts.element,function(i){i!==e&&null!==i&&(t.updateSelection(i),t.close(),t.clearSearch())})}},clearSearch:function(){var t=this.getPlaceholder(),i=this.getMaxSearchWidth();t!==e&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(t).addClass("select2-default"),this.search.width(i>0?i:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),this.updateResults(!0),this.search.focus(),this.opts.element.trigger(t.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(e){var i=[],a=[],n=this;t(e).each(function(){s(n.id(this),i)<0&&(i.push(n.id(this)),a.push(this))}),e=a,this.selection.find(".select2-search-choice").remove(),t(e).each(function(){n.addSelectedChoice(this)}),n.postprocessResults()},tokenize:function(){var t=this.search.val();t=this.opts.tokenizer.call(this,t,this.data(),this.bind(this.onSelect),this.opts),null!=t&&t!=e&&(this.search.val(t),t.length>0&&this.open())},onSelect:function(t,e){this.triggerSelect(t)&&(this.addSelectedChoice(t),this.opts.element.trigger({type:"selected",val:this.id(t),choice:t}),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(t,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()&&this.updateResults(!0),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:t}),e&&e.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(i){var s,a,n=!i.locked,o=t("
  • "),r=t("
  • "),l=n?o:r,h=this.id(i),c=this.getVal();s=this.opts.formatSelection(i,l.find("div"),this.opts.escapeMarkup),s!=e&&l.find("div").replaceWith("
    "+s+"
    "),a=this.opts.formatSelectionCssClass(i,l.find("div")),a!=e&&l.addClass(a),n&&l.find(".select2-search-choice-close").on("mousedown",m).on("click dblclick",this.bind(function(e){this.isInterfaceEnabled()&&(t(e.target).closest(".select2-search-choice").fadeOut("fast",this.bind(function(){this.unselect(t(e.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),this.close(),this.focusSearch()})).dequeue(),m(e))})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),l.data("select2-data",i),l.insertBefore(this.searchContainer),c.push(h),this.setVal(c)},unselect:function(t){var e,i,a=this.getVal();if(t=t.closest(".select2-search-choice"),0===t.length)throw"Invalid argument: "+t+". Must be .select2-search-choice";if(e=t.data("select2-data")){for(;(i=s(this.id(e),a))>=0;)a.splice(i,1),this.setVal(a),this.select&&this.postprocessResults();t.remove(),this.opts.element.trigger({type:"removed",val:this.id(e),choice:e}),this.triggerChange({removed:e})}},postprocessResults:function(t,e,i){var a=this.getVal(),n=this.results.find(".select2-result"),o=this.results.find(".select2-result-with-children"),r=this;n.each2(function(t,e){var i=r.id(e.data("select2-data"));s(i,a)>=0&&(e.addClass("select2-selected"),e.find(".select2-result-selectable").addClass("select2-selected"))}),o.each2(function(t,e){e.is(".select2-result-selectable")||0!==e.find(".select2-result-selectable:not(.select2-selected)").length||e.addClass("select2-selected")}),-1==this.highlight()&&i!==!1&&r.highlight(0),!this.opts.createSearchChoice&&!n.filter(".select2-result:not(.select2-selected)").length>0&&(!t||t&&!t.more&&0===this.results.find(".select2-no-results").length)&&M(r.opts.formatNoMatches,"formatNoMatches")&&this.results.append("
  • "+r.opts.formatNoMatches(r.search.val())+"
  • ")},getMaxSearchWidth:function(){return this.selection.width()-r(this.search)},resizeSearch:function(){var t,e,i,s,a,n=r(this.search);t=v(this.search)+10,e=this.search.offset().left,i=this.selection.width(),s=this.selection.offset().left,a=i-(e-s)-n,t>a&&(a=i-n),40>a&&(a=i-n),0>=a&&(a=t),this.search.width(Math.floor(a))},getVal:function(){var t;return this.select?(t=this.select.val(),null===t?[]:t):(t=this.opts.element.val(),o(t,this.opts.separator))},setVal:function(e){var i;this.select?this.select.val(e):(i=[],t(e).each(function(){s(this,i)<0&&i.push(this)}),this.opts.element.val(0===i.length?"":i.join(this.opts.separator)))},buildChangeDetails:function(t,e){for(var e=e.slice(0),t=t.slice(0),i=0;i. Attach to instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var e=[],i=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){e.push(i.opts.id(t(this).data("select2-data")))}),this.setVal(e),this.triggerChange()},data:function(e,i){var s,a,n=this;return 0===arguments.length?this.selection.find(".select2-search-choice").map(function(){return t(this).data("select2-data")}).get():(a=this.data(),e||(e=[]),s=t.map(e,function(t){return n.opts.id(t)}),this.setVal(s),this.updateSelection(e),this.clearSearch(),i&&this.triggerChange(this.buildChangeDetails(a,this.data())),void 0)}}),t.fn.select2=function(){var i,a,n,o,r,l=Array.prototype.slice.call(arguments,0),h=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],c=["opened","isFocused","container","dropdown"],d=["val","data"],u={search:"externalSearch"};return this.each(function(){if(0===l.length||"object"==typeof l[0])i=0===l.length?{}:t.extend({},l[0]),i.element=t(this),"select"===i.element.get(0).tagName.toLowerCase()?r=i.element.prop("multiple"):(r=i.multiple||!1,"tags"in i&&(i.multiple=r=!0)),a=r?new L:new F,a.init(i);else{if("string"!=typeof l[0])throw"Invalid arguments to select2 plugin: "+l;if(s(l[0],h)<0)throw"Unknown method: "+l[0];if(o=e,a=t(this).data("select2"),a===e)return;if(n=l[0],"container"===n?o=a.container:"dropdown"===n?o=a.dropdown:(u[n]&&(n=u[n]),o=a[n].apply(a,l.slice(1))),s(l[0],c)>=0||s(l[0],d)&&1==l.length)return!1}}),o===e?this:o},t.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(t,e,i,s){var a=[];return b(t.text,i.term,a,s),a.join("")},formatSelection:function(t,i,s){return t?s(t.text):e},sortResults:function(t){return t},formatResultCssClass:function(){return e},formatSelectionCssClass:function(){return e},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(t,e){var i=e-t.length;return"Please enter "+i+" more character"+(1==i?"":"s")},formatInputTooLong:function(t,e){var i=t.length-e;return"Please delete "+i+" character"+(1==i?"":"s")},formatSelectionTooBig:function(t){return"You can only select "+t+" item"+(1==t?"":"s")},formatLoadMore:function(){return"Loading more results..."},formatSearching:function(){return"Searching..."},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(t){return t.id},matcher:function(t,e){return i(""+e).toUpperCase().indexOf(i(""+t).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:x,escapeMarkup:S,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(t){return t},adaptDropdownCssClass:function(){return null},nextSearchTerm:function(){return e}},t.fn.select2.ajaxDefaults={transport:t.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:w,local:k,tags:C},util:{debounce:c,markMatch:b,escapeMarkup:S,stripDiacritics:i},"class":{"abstract":E,single:F,multi:L}}}}(jQuery);